//工单列表请求参数
export interface WordOrderRequestType {
    page: number,
    pageSize: number,
    category: string,//我的工单：ower  全部工单：all
    ticket_state: number | null//工单状态
    ticket_title: string//工单标题,工单编号,设备编号搜索参数
    // id: string
    // ticket_id: string
}


//工单列表返回参数
export interface WorkOrderListType {
    current_page: number,
    message: string,
    num_pages: number,
    page_size: number,
    statusCode: number,
    total: number,
    data: ListItemType[]
}

export interface ListItemType {
    cc_users: string[],
    close_time: string,
    create_time: string,
    created_by: string,
    customer: string,
    customer_remark: string,
    department: string,
    device_sn: string,
    device_sn_cust: string,
    device_status: string,
    due_time: string,
    first_time: string,
    last_time: string,
    owner: string,
    product: string,
    reason_type: string,
    reporter: string,
    result: string,
    score: string,
    supervisor: string,
    ticket_cate: string,
    ticket_desc: string,
    ticket_number: number,
    ticket_state: string,
    ticket_title: string,
    ticket_type: string,
    trust_ref_no: string,
    updated_by: string
    updated_time: string
}

//通知方法设定回显
export interface MethodSetting {
    name: string
    value: boolean
}


//新增form绑定字段
export interface AddFormType {
    created_by: null | number, //工单创建人id
    created_by_name: string, //工单创建人名称
    supervisor: null | number, //负责人id
    supervisor_name: string, //负责人名称
    customer: string, // FAB名称
    customer_id: null | number// FABid
    reporter: number | null, // 客户联系人id
    reporter_name: string //客户联系人名称
    phone_number: string, //电话
    email_address: string, //邮箱
    ticket_type_name: string, //工单类型名称
    ticket_type: null | number, //工单类型id
    ticket_cate_name: string, //工单分类名称
    ticket_cate: null | number, //工单分类id
    device_sn_cust: string, //客户设备编号
    device_sn_cust_name: string, //客户设备编号名称
    device_status_name: string, //设备状态名称
    device_status: string, //设备状态
    device_type: string, //设备型号
    device_sn: string, //设备序列号
    device_warranty: string, //备保修日
    component_warranty: string, //部件保修日
    ticket_title: string, //标题
    to_user: null | number, //TO id
    to_user_name: string, //TO名称
    cc_users_name: string, //CC名称
    cc_users: string[], //CCid
    ticket_desc: string, //详细描述
    attachment: Record<string, any>[] //附件
}

//新增获取客户信息
export interface ClientType {
    new_ticket_fulltext_on: boolean
    statusCode: number
    customer_list: CustomerListType[]
    user_info: UserInfoType
}

export interface CustomerListType {
    id: number
    name: string
}

export interface UserInfoType {
    created_by: { id: number, name: string }
    customer: { id: null, name: string }
    customer_id: string
    email_address: string
    id: string
    phone_number: string
    reporter: { id: number, name: string }
    supervisor: string
}

//FAB下拉选项返回数据类型
export interface FabType {
    message: string
    statusCode: number
    data: FabItemType[]
}

export interface FabItemType {
    id: number
    name: string
    username?: string
}

export interface CustomerListType {
    id: number
    name: string
}

export interface ContactReturnType {
    message: string
    data: ContactType
    statusCode: number
}


//通讯录列表
export interface ContactType {
    favorites: CommonlyType[]
    users: ContactItemType[]
}

//常用列表类型
export interface CommonlyType {
    id: string
    name: string
    username?: string
}

//常用列表类型
export interface ContactItemType {
    name: string
    children: CommonlyType[]
}

// 列表展示数据
export interface ListType {
    state_text: string//状态
    to: WorkPersonType//to
    cc: OptionType[]//cc
    due_time: string//截止时间
    trust_ref_no: string//TRUST编号
    reason_type: number//原因类别
    scores: number//评分
    comment: string//说明
    operation_text: string//操作
    from: WorkPersonType//处理人
    time: string//时间
    type: number// 0：按钮  1：留言
    is_public: number//公开范围
    chat_content: string//留言
    attachments: UploadType[]//附件
}

export interface WorkPersonType {
    username: string,
    name: string,
    user_type: number,
    id: number
}

export interface UploadType {
    file_name: string,
    file_path: string
}

// to和cc下拉数据
export interface OptionType {
    id: string,
    name: string
    username: string
}


// 步骤条数据类型
export interface StepType {
    id: number,
    state: string
}

// 按钮数据类型
export interface ButtonType {
    init_data: WorkType,//数据
    name: string//唯一标识
    text: string//按钮名称
}

// 详情第一模块
export interface UserInfoObjType {
    create_by: WorkPersonType,//工单创建人
    supervisor: WorkPersonType//负责人
    customer: { id: number, name: string },//FAB
    reporter: WorkPersonType//客户联系人
    reporter_phone: string//电话
    reporter_email: string//邮箱
}

// 详情第二模块
export interface TicketInfoType {
    ticket_type: number,//工单类型
    ticket_cate: number//工单分类
    device_sn_cust: { id: number, name: string },//客户设备编号
    device_status: number//设备状况
    device_type: string//设备型号
    device_sn: string//设备序列号
    device_warranty: string//设备保修到期日
    component_warranty: string//部件保修到期日
}

// 详情第三模块
export interface TicketType {
    ticket_title: string,//标题
    ticket_desc: string//详情
    attachments: UploadType[]//附件
}

export interface WorkType {
    cc: { id: string, username: string, name: string }[]//cc回显数据
    due_time: string | null//截至时间
    reason_type: number | null//原因类别
    to: { name: string, username: string } | null//to回显数据
    trust_ref_no: string | null//TRUST编号
}

//创建工单下确认按钮，修改按钮弹窗回显字段
export interface SubMitType {
    created_by: null | number, //工单创建人id
    created_by_name: string, //工单创建人名称
    supervisor: null | number, //负责人id
    supervisor_name: string, //负责人
    customer: string, // FAB名称
    customer_id: null | number// FAB id
    reporter: null | number, // 客户联系人id
    reporter_name: string, // 客户联系人名称
    phone_number: string, //电话
    email_address: string, //邮箱
    ticket_type: null | number, //工单类型id
    ticket_type_name: string, //工单类型name
    ticket_cate: null | number, //工单分类
    ticket_cate_name: string, //工单分类name
    device_sn_cust: null | number, //客户设备编号
    device_sn_cust_name: string, //客户设备编号name
    device_status: null | number, //设备状态id
    device_status_name: string, //设备状态name
    device_type: string, //设备型号
    device_sn: string, //设备序列号
    device_warranty: string, //备保修日
    component_warranty: string, //部件保修日
    ticket_title: string, //标题
    to_user: null | number, //TOid
    to_user_name: string, //TO名称
    cc_users?: string[], //CCid默认选中数据
    cc_users_list?: OptionType[], //CCid默认选中数据
    cc_users_name?: string//选中名称
    // cc_list: OptionType[], //CC默认选中数据
    ticket_desc: string, //详细描述
    attachment: { file_name: string; file_path: string }[] //附件
    ticket_number: number | null//工单编号
}

//详情新增表单
export interface EditAddType {
    to_user: string//TO
    to_username: string//TO
    cc_users: string[]//CCid
    cc_users_name: string//CC名称
    due_time: string | null//截至时间
    trust_ref_no: string | null//TRUST编号
    reason_type: null | number//原因类别
    reason_type_name: string//原因类别
    comment: string//说明
    scores: null | number//评分
    appraise: string//评价
    is_public: number | null//公开范围
    attachment: Record<string, any>[] //附件
}

export interface WorkOrderType {
    title: string//搜索内容
    ticket: InForMation[]//工单
    information: InForMation[]//资料
    video: InForMation[]//视频
}

export interface InForMation {
    title: string//标题
    content: string//内容
    id: number//id
    ticket_number: number//工单号
    template_id?: number//类型
    sub_items: SubItemsType[]
    keyword: string[]
}

export interface SubItemsType {
    content: string,
    title: string,
    type: string,
    keyword: string[]
}

